#ifndef _NE_RAY_H_
#define _NE_RAY_H_

#include <mathematics/Vector3.h>

namespace ne
{
    class Plane;
    class AABB;
    class Sphere;

    class NEAPI Ray
    {
        public:
            Ray();

            Ray(const Ray &r);

            Ray(const Vector3 &pos, const Vector3 &dir);

            void redefine(const Vector3 &pos, const Vector3 &dir);

            real normalize();

            Vector3 getPoint(const real dist) const;

            Ray& operator = (const Ray &r);

            bool operator == (const Ray &r) const;

            bool operator != (const Ray &r) const;

            bool intersects(const AABB &a) const;

            bool intersects(const Sphere &s) const;

            bool intersects(const Plane &p) const;

            bool trace(const Plane &p, real &t) const;

            // Function for writing to a stream.
            NEAPI friend std::ostream& operator << (std::ostream &o, const Ray &r);

            inline ~Ray() {}

        public:
            Vector3 origin;
            Vector3 direction;
    };
}

#endif
